﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace Zzj.Windows
{
    /// <summary>
    /// PasswordWindow.xaml 的交互逻辑
    /// </summary>
    public partial class PasswordWindow : Window
    {
        public PasswordWindow()
        {
            InitializeComponent();
            this.Loaded += Win_Loaded;
        }

        private void Win_Loaded(object sender, RoutedEventArgs e)
        {
            this.Dispatcher.BeginInvoke(DispatcherPriority.Background,
                (Action)(() => { Keyboard.Focus(txtPass); }));
        }

        private void btn_Click_OK(object sender, RoutedEventArgs e)
        {
            string password = txtPass.Password;
            if (password.Equals(App.getConfig().SettingPassword))
            {
                this.DialogResult = true;
                this.Close();
            }
            else
            {
                MessageBox.Show("密码错误");
            }
        }
    }
}
